package org;

import org.doc.Empdoc;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.repository.EmpRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.elasticsearch.core.ElasticsearchTemplate;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.yanfengying.AppStart;

import java.util.UUID;
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest(classes = AppStart.class)
public class text2 {
    @Autowired
    private ElasticsearchTemplate elasticsearchTemplate;
    @Autowired
    private EmpRepository empRepository;
    @Test
    public void test()throws Exception{

        //创建索引库
        elasticsearchTemplate.createIndex(Empdoc.class);
        //映射
        elasticsearchTemplate.putMapping(Empdoc.class);
    }
    @Test
    public void testSave()throws Exception{
        Empdoc empdoc = new Empdoc(1L, "zs", "lllll");
        empRepository.save(empdoc);
    }
}
